
#include "dpc.h"
using namespace WtfEngine;

DpcDispatcher::DpcDispatcher()
: Task<DpcDispatcher>(1000, "DPC Dispatcher") {
};

void DpcDispatcher::QueueDpc(const Functor::tRef& rDpc) {
	mDpcs.push_back(rDpc);
};

void DpcDispatcher::Run() {
	for(std::list<Functor::tRef>::const_iterator i = mDpcs.begin(); i != mDpcs.end(); i++) {
		(**i)();
	};

	mDpcs.clear();
};
